<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>微信会员管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function changeType(type){
			if(type=="0"){
				document.getElementById("score").style.display="none";
				document.getElementById("temp").value="0";
			}
			if(type=="1"){
				document.getElementById("score").style.display="";
			}
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/wechat/wechatMember/">微信会员列表</a></li>
		<li class="active"><a href="javascript;">微信会员充值</a> </li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="wechatMember" action="${ctx}/wechat/wechatMember/saveScore" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<tags:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">选择充值类型:</label>
			<div class="controls">
				<input type="radio" name="type" class="required" value="0" onclick="changeType(this.value)"/>押金信用积分&nbsp;&nbsp;&nbsp;
				<input type="radio" name="type" class="required" value="1" onclick="changeType(this.value)"/>充值信用积分&nbsp;&nbsp;&nbsp;
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">充值积分:</label>
			<div class="controls">
				<input name="chargeScore"  type="text"  class="required number" value="0.000"/>
				<label style="color:grey"><span class="alert">（元）精确到小数点后三位</span></label>
			</div>
		</div>
		<div id="score" style="display:none" class="control-group">
			<label class="control-label">赠送积分:</label>
			<div class="controls">
				<input id="temp" name="tempScore"  type="text"  value="0.000" class="required number"/>
				<label style="color:grey"><span class="alert">（元）精确到小数点后三位，默认不赠送</span></label>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="wechat:wechatMember:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
